<template>
  <div class="hello">
    <p>{{ modelValue }}</p>
    <button v-on="clearEvent">清空</button>
  </div>
</template>

<script>
export default {
  name: 'HelloWorld',
  props: {
    modelValue: String
  },
  emits: ['update:modelValue'], 
  computed: {
    clearEvent() {
      return {
        click: () => {
          this.$emit('update:modelValue', '')
        }
      }
    }
  }
}
</script>

<style scoped>
.hello {
  background-color: #f9f9f9;
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
  max-width: 400px;
  width: 100%;
  text-align: center;
}

.hello p {
  font-size: 20px;
  color: #2c3e50;
  margin-bottom: 20px;
  word-break: break-word;
}

.hello button {
  background-color: #42b983;
  border: none;
  color: white;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.2s ease;
}

.hello button:hover {
  background-color: #36996e;
}
</style>